<?php
/**
 * 纷纷卷
 * 
 */
class mcouponCtrl extends lib_ctrl{
	/*
	 * 初始化
	 */
	public function init(){
		$this->coupon = $this->loadModel('coupon');
		$this->member = $this->loadModel('member');
		if($_COOKIE['member_uid']!=0){
			$this->view->assign('member_info',array('member_uid'=>$_COOKIE['member_uid'],'member_name'=>$_COOKIE['member_name']));
		}
		$this->view->assign('action','coupon');
	}
	
	public function indexAct(){
		
		$currUid = $this->member->getNowUid();
		$res = $this->coupon->setMemberID($currUid)->setLimit(10)->select();
		if($res){
			$this->view->assign('coupons',$res);
		}
		$this->view->assign('status','');
		$this->view->display('member/coupon.html');
	}
	/*
	 * 过期
	 */
	public function expireAct(){
		$currUid = $this->member->getNowUid();
		$res = $this->coupon->setMemberID($currUid)->setLimit(10)->select();
		if($res){
			$this->view->assign('expire_coupons',$res);
		}
		$this->view->assign('status','expire');
		$this->view->display('member/coupon_expire.html');
	}
	/*
	 * 未使用
	 */
	public function consumeAct(){
		$currUid = $this->member->getNowUid();
		$res = $this->coupon->setMemberID($currUid)->setLimit(10)->select();
		if($res){
			$this->view->assign('consume_coupons',$res);
		}
		$this->view->assign('status','consume');
		$this->view->display('member/coupon_consume.html');
	}

} 